package com.xlh.param.user;

import com.xlh.constant.UserConstant;
import com.xlh.util.InputValidator;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Pattern;

/**
 * 修改用户密码参数
 * <p>
 * Created by lx on 2019/2/21 0021.
 */
@Data
public class UpdateUserPwdParam {

    @ApiModelProperty(value = "旧密码")
    @NotBlank(message = "请输入原密码")
    private String oldPassword;

    @ApiModelProperty(value = "新密码")
    @NotBlank(message = "请输入新密码")
    @Pattern(regexp = UserConstant.REGEX_PASSWORD, message = "请输入6-14位数字或英文密码")
    private String newPassword;

    public String getNewPassword() {
        return InputValidator.regSpecialChar(newPassword);
    }

}
